#ifndef _MP3_PARSER_H
#define _MP3_PARSER_H
/*
 * MP3Parser.h
 * ---------------------------------------------------------------
 * Project     : SoundSeeker
 * Version     : 1.0
 
 * Category    : mp3 reader
 * Created by  : Florian Loferer, 09/2010
 * ---------------------------------------------------------------
 ** Description : 
 *		This class is used to wrap the ANSI-C mpg123lib into a C++
 *		context. The parser also gets the metadata from the .MP3
 *		file and sets it to the passed SoundSample instance.
 * ---------------------------------------------------------------
 * Copyright (C) 2010-2011, Florian Loferer
 *
 * This file is part of the SoundSeeker audio sample library administration tool.
 * For conditions of distribution and use, see the accompanying README file.
 */


#include "mpg123.h"
#include <unistd.h>
#include <stdio.h>
#include <QString>
#include <QObject>
#include "SoundSample.h"

#define MPG123_ENC_8 15
#define MPG123_ENC_16 64
#define MPG123_ENC_24 16384

using namespace std;
class MP3Parser : public QObject
{
	Q_OBJECT
	
public:
	// returns the pointer to the data array, otherwise NULL
	unsigned char* parse( SoundSample* parentSample, size_t & buffer_return_size);
	// gets the ID3 tags and sets the info to passed sample instance
	int gatherID3Info( SoundSample* parentSample);

private:
	void separateLines(string & buffer, mpg123_string* inlines);
	
signals:
	void percentFinishedParsing(int);
};

#endif